package com.mohan.config;

import com.mohan.bean.Person;
import com.mohan.service.BookService;
import org.springframework.context.annotation.*;
import org.springframework.core.type.filter.AspectJTypeFilter;
import org.springframework.core.type.filter.RegexPatternTypeFilter;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;

@Configuration

/**
 * 普通注解扫描
 */
//@ComponentScan(value = "com.mohan",excludeFilters = {
//        @ComponentScan.Filter(type = FilterType.ANNOTATION,classes = { Service.class})
//},useDefaultFilters = false)
//@ComponentScan(value = "com.mohan",includeFilters = {
//        @ComponentScan.Filter(type = FilterType.ANNOTATION,classes = Controller.class)
//},useDefaultFilters = false)

/**
 * 批量租借扫描
 */
//@ComponentScans(value = {
//        @ComponentScan(value = "com.mohan", excludeFilters = {
//                @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {Service.class})
//        }, useDefaultFilters = false),
//        @ComponentScan(value = "com.mohan", includeFilters = {
//                @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = Controller.class)
//        }, useDefaultFilters = false)
//})

/**
 * 按照给定的类型进行包含或者排除
 * 不管是实现类都会排除掉
 */
//@ComponentScan(value = "com.mohan", includeFilters = {
//        @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {BookService.class})
//}, useDefaultFilters = false)

/**
 * 按照指定的ASPECTJ表达式包含或者排除
 * 基本不怎么用
 */
//@ComponentScan(value = "com.mohan",includeFilters = {
//        @ComponentScan.Filter(type = FilterType.ASPECTJ,classes = {AspectJTypeFilter.class})
//},useDefaultFilters = false)

/**
 *按照正则表达式包含或者排除
 * 这种也基本不怎么用
 */
//@ComponentScan(value = "com.mohan",includeFilters = {
//        @ComponentScan.Filter(type = FilterType.REGEX,classes = {RegexPatternTypeFilter.class})
//})

/**
 * 按照自定义规则进行包含或者排除
 */
//@ComponentScan(value = "com.mohan", includeFilters = {
//        @ComponentScan.Filter(type = FilterType.CUSTOM, classes = {MyTypeFilter.class})
//}, useDefaultFilters = false)
public class MainConfig {

//    @Bean("person")
//    public Person person() {
//        return new Person("莫大人", 22);
//    }
}
